package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.entity.TbCategory;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 商品类目表，类目和商品(spu)是一对多关系，类目与品牌是多对多关系 Mapper 接口
 * </p>
 *
 * @author HM
 * @since 2020-10-07
 */
public interface TbCategoryMapper extends BaseMapper<TbCategory> {

    /**
     * 根据品牌id查询分类集合
     * @param brandId
     * @return
     */
    @Select("SELECT a.* FROM tb_category a,tb_category_brand b WHERE b.brand_id=#{brandId} AND a.id = b.category_id")
    List<TbCategory> selectListByBrandId(Long brandId);
}
